<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
    }

    li {
        list-style-type: none;
    }

    a {
        text-decoration: none;
        font-size: 14px;
    }

    .nav {
        margin: 100px;
    }

    .nav > li {
        position: relative;
        float: left;
        width: 80px;
        height: 41px;
        text-align: center;
    }

    .nav li a {
        display: block;
        width: 100%;
        height: 100%;
        line-height: 41px;
        color: #333;
    }

    .nav > li > a:hover {
        background-color: #eee;
    }

    .nav ul {
        display: none;
        position: absolute;
        top: 41px;
        left: 0;
        width: 100%;
        border-left: 1px solid #FECC5B;
        border-right: 1px solid #FECC5B;
    }

    .nav ul li {
        border-bottom: 1px solid #FECC5B;
    }

    .nav ul li a:hover {
        background-color: #FFF5DA;
    }
</style>
<body>
<ul class="nav">
    <li>
        <a href="#">微博</a>
        <ul>
            <li>
                <a href="">私信</a>
            </li>
            <li>
                <a href="">评论</a>
            </li>
            <li>
                <a href="">@我</a>
            </li>
        </ul>
    </li>
    <li>
        <a href="#">微博</a>
        <ul>
            <li>
                <a href="">私信</a>
            </li>
            <li>
                <a href="">评论</a>
            </li>
            <li>
                <a href="">@我</a>
            </li>
        </ul>
    </li>
    <li>
        <a href="#">微博</a>
        <ul>
            <li>
                <a href="">私信</a>
            </li>
            <li>
                <a href="">评论</a>
            </li>
            <li>
                <a href="">@我</a>
            </li>
        </ul>
    </li>
    <li>
        <a href="#">微博</a>
        <ul>
            <li>
                <a href="">私信</a>
            </li>
            <li>
                <a href="">评论</a>
            </li>
            <li>
                <a href="">@我</a>
            </li>
        </ul>
    </li>
</ul>

<script>

    // 1.获取元素
    const liArr = document.querySelector('.nav').children;

    for (let li of liArr) {
        // 鼠标经过 li标签, 让li里面的第二个孩子显示
        li.onmouseover = function () {
            this.children[this.children.length - 1].style.display = 'block';
        }
        // 鼠标离开 li标签, 让li里面的第二个孩子隐藏
        li.onmouseout = function () {
            this.children[this.children.length - 1].style.display = 'none';
        }
    }
</script>

</body>
</html>
